const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            photo,
            treeData1: [],
            page: {
                value1: '',
                value2: '',
                value3: '',
                value4: '',
                value5: '',
                value6: '',
                PageNumber: 1, //页码
                RowAmount: 30,
                Condition: window.btoa(unescape(encodeURIComponent("%%,%%,%%,%%,%%,%%"))),
                ExtensionCondition: ''
            },
        }
    },
    mounted() {

    },
    methods: {
        check() {
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value2 + "%,%" + this.page.value1 + "%," + this.page.value3 + "%,%" + this.page.value4 + "%,%" + this.page.value5 + "%,%" + this.page.value6 + "%")));
            this.postgetList(this.page)
        },
        Treedata() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/clientOperation/getDistrictTree`,
                type: "GET",
                data: {
                    DistrictCode: '232723'
                },
                success: (data) => {
                    this.treeData1 = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "post",
                data: {
                    Data: 'blue_plate_information',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    console.log(data);
                    this.treeData = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        handleRoom(row) {
            if (row.Self_Built_Houses == '0') {
                if (row.Live_Status == '1') {
                    window.location.href = '../blue_plate_information/add1.html?action=Modify&Blue_Plate_SerialNumber=' + row.Blue_Plate_SerialNumber
                        + "&House_Room_SerialNumber=" + row.House_Room_SerialNumber;
                } else {
                    window.location.href = '../blue_plate_information/add1.html?action=Add&Blue_Plate_SerialNumber=' + row.Blue_Plate_SerialNumber
                        + "&House_Room_SerialNumber=" + row.House_Room_SerialNumber;
                }
            } else {
                this.$message({
                    message: '检查当前蓝牌为自建房，点击下方按钮关联人口',
                    type: 'warning'
                })
            }
        },
        handleNodeClick1(data, node) {
            this.page.value3 = data.ProvinceNumber;
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value2 + "%,%" + this.page.value1 + "%," + this.page.value3 + "%,%" + this.page.value4 + "%,%" + this.page.value5 + "%,%" + this.page.value6 + "%")));
            this.postgetList(this.page)
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "post",
                data: {
                    Data: 'blue_plate_information',
                    Condition: "Row_Status='0' AND blue_plate_information.Village_SerialNumber LIKE '" + this.page.value3 + "%'",
                },
                success: (data) => {
                    this.treeData = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        //树的点击筛选事件
        handleNodeClick(data, node) {
            this.page.value1 = data.Blue_Plate_SerialNumber;
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value2 + "%,%" + this.page.value1 + "%," + this.page.value3 + "%,%" + this.page.value4 + "%,%" + this.page.value5 + "%,%" + this.page.value6 + "%")));
            this.postgetList(this.page)
        },
        Organization(data, arr) {
            data.forEach(item => {
                arr.push(item.Party_Organization_SerialNumber);
                if (item.children && item.children.length > 0) {
                    this.Organization(item.children, arr);
                }
            })
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
